package com.yootk.gateway.action;

import org.springframework.cloud.gateway.filter.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ServerWebExchange;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/gateway/action/*") // 定义访问父路径
public class GatewayAction { // 网关Action
    @RequestMapping("globalforward") // 定义子路径
    public Map<String, String> forward(ServerWebExchange exchange) {
        ReactiveLoadBalancerClientFilter s;
        Map<String, String> result = new HashMap<>(); // 保存所有的处理结果
        result.put("message", "forward"); // 信息保存
        result.put("requestId", exchange.getRequest().getId());
        result.put("requestPath", exchange.getRequest().getPath().toString());
        return result;
    }
}
